-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement basic error recovery #2020
Conversation
…ree non-terminals
…arser implementation
Sometimes recovery nodes start before the current location where the parser failed to continue. Since the parser works with a short queue of schedulede TODO's around the current cursor, we might end up outside of this queue when recovering. This breaks several unspecified invariants of the SGTBF implementations. For now I added a detection that a recovery node is to be planned before the currently retained history and filter that recovery node. The next step will be to make sure backtracking over the current location is made possible.
…er input locations)
… because the next parser loop iteration always wants to advance one character
…e version of Rascal and (b) the edit command is wired to the edit IDEService
…t in the scheme by copyinhthe contents to a tmp file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's an impressive amount of work! I'm very curious to see all this working in VS Code down the line 🙂 For now, I think none of my comments are blocking. Lots of minor nits, and other than that, just a bunch of questions about certain implementation choices and small suggestions. In general, the approach looks sound to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also gone through and added some questions/remarks.
Impressive piece of work 👍
src/org/rascalmpl/library/lang/rascal/tests/recovery/BasicRecoveryTests.rsc
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/library/lang/rascal/tests/recovery/BasicRecoveryTests.rsc
Outdated
Show resolved
Hide resolved
src/org/rascalmpl/parser/uptr/recovery/CaseInsensitiveLiteralMatcher.java
Outdated
Show resolved
Hide resolved
Implement basic error recovery
Implement basic error recovery
Implement basic error recovery
This PR implements a basic error recoverer and fixes some issues in the existing error recovery support code.
The new recoverer is called "ToTokenRecoverer" and tries to find a suitable continuation token when recovering from a parse error.
When the parser detects a parse error, the error recover skips part of the input and reduces the production that is currently being recognized. It then let the parser continue.
To determine which part of the input to skip, the recoverer tries to find a literal that could terminate the current production or a literal that could start the next sibling production. If such a literal is found, all input until after the "end" literal or all input until before the "next" literal will be skipped and parsing will continue.